<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Hard
  </div>
  <div>
   <h1 class="question_title">
    32. Longest Valid Parentheses
   </h1>
   <p>
    Given a string containing just the characters
    <code>
     '('
    </code>
    and
    <code>
     ')'
    </code>
    , find the length of the longest valid (well-formed) parentheses substring.
   </p>
   <p>
    <strong>
     Example 1:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> "(()"
<strong>Output:</strong> 2
<strong>Explanation:</strong> The longest valid parentheses substring is <code>"()"</code>
</pre>
   <p>
    <strong>
     Example 2:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> "<code>)()())</code>"
<strong>Output:</strong> 4
<strong>Explanation:</strong> The longest valid parentheses substring is <code>"()()"</code>
</pre>
  </div>
  <div>
   <h1 class="question_title">
    32. 最长有效括号
   </h1>
   <p>
    给定一个只包含
    <code>
     '('
    </code>
    &nbsp;和
    <code>
     ')'
    </code>
    &nbsp;的字符串，找出最长的包含有效括号的子串的长度。
   </p>
   <p>
    <strong>
     示例&nbsp;1:
    </strong>
   </p>
   <pre><strong>输入:</strong> "(()"
<strong>输出:</strong> 2
<strong>解释:</strong> 最长有效括号子串为 <code>"()"</code>
</pre>
   <p>
    <strong>
     示例 2:
    </strong>
   </p>
   <pre><strong>输入:</strong> "<code>)()())</code>"
<strong>输出:</strong> 4
<strong>解释:</strong> 最长有效括号子串为 <code>"()()"</code>
</pre>
  </div>
 </body>
</html>